/*****************************
 * W E A T H E R   R U L E S *
 *****************************/

%temperature(0, 20, 50).
%temperature(1, 0, 30).
%temperature(2, -10, 15).

rule(
	'WEATHERR00a',
	lhs([av(whichday,today)]),
	rhs(av(which_day,0),1)
).

rule(
	'WEATHERR00b',
	lhs([av(whichday,tomorrow)]),
	rhs(av(which_day,1),1)
).

rule(
	'WEATHERR00c',
	lhs([av(whichday,tomorrow_tomorrow)]),
	rhs(av(which_day,2),1)
).

rule(
	'WEATHERR01',
	lhs([av(temper(Day, Time), X), X >= 40]),
	rhs(av(temp_categorize(Day, Time), very_hot), 0.9)
).
rule(
	'WEATHERR02',
	lhs([av(temper(Day, Time), X), X < 40, X >= 30]),
	rhs(av(temp_categorize(Day, Time), hot), 0.9)
).
rule(
	'WEATHERR03',
	lhs([av(temper(Day, Time), X), X < 30, X >= 20]),
	rhs(av(temp_categorize(Day, Time), comfortable), 0.9)
).
rule(
	'WEATHERR04',
	lhs([av(temper(Day, Time), X), X < 20, X >= 10 ]),
	rhs(av(temp_categorize(Day, Time), cold), 0.9)
).
rule(
	'WEATHERR05',
	lhs([av(temper(Day, Time), X), X < 10, X >= 0]),
	rhs(av(temp_categorize(Day, Time), very_cold), 0.9)
).
rule(
	'WEATHERR06',
	lhs([av(temper(Day, Time), X), X < 0]),
	rhs(av(temp_categorize(Day, Time), frozen), 0.9)
).

rule(
	'WEATHERR07',
	lhs([temperature(Day, Min, Max), X is (Min + Max)/2]),
	rhs(av(temper(Day, breakfast), X), 0.9)
).

rule(
	'WEATHERR08',
	lhs([temperature(Day, Min, Max), X is (Min + Max*3)/4]),
	rhs(av(temper(Day, lunch), X), 0.9)
).
rule(
	'WEATHERR09',
	lhs([temperature(Day, Min, Max), X is (Min*3 + Max)/4]),
	rhs(av(temper(Day, dinner), X), 0.9)
).

% Chế độ ăn trong thời tiết nóng
rule(
	'WEATHERR10',
	lhs([av(which_day, Day), av(mealTime, Time), av(temp_categorize(Day, Time), hot), av(hotcold(X),cold)]),
	rhs(av(like_recipe(X), true), 0.4)
).

% Chế độ ăn trong thời tiết nóng bức
rule(
	'WEATHERR11',
	lhs([av(which_day, Day), av(mealTime, Time), av(temp_categorize(Day, Time), very_hot), av(hotcold(X), cold)]),
	rhs(av(like_recipe(X), true), 0.45)
).

% Chế độ ăn trong thời tiết lạnh
rule(
	'WEATHERR12',
	lhs([av(which_day, Day), av(mealTime, Time), av(temp_categorize(Day, Time), cold), av(hotcold(X), hot)]),
	rhs(av(like_recipe(X), true), 0.3)
).

% Chế độ ăn trong thời tiết lạnh giá
rule(
	'WEATHERR13a',
	lhs([av(which_day, Day), av(mealTime, Time), av(temp_categorize(Day, Time), very_cold), av(hotcold(X), hot)]),
	rhs(av(like_recipe(X),true), 0.4)
).

rule(
	'WEATHERR13b',
	lhs([av(which_day,Day), av(mealTime, Time), av(temp_categorize(Day,Time), very_cold), av(protein(X), high)]),
	rhs(av(like_recipe(X), true), 0.4)
).
rule(
	'WEATHERR13c',
	lhs([av(which_day,Day), av(mealTime, Time), av(temp_categorize(Day, Time), very_cold), av(fat(X), high)]),
	rhs(av(like_recipe(X), true), 0.4)
).

% Chế độ ăn trong thời tiết băng giá
rule(
	'WEATHERR14a',
	lhs([av(which_day,Day), av(mealTime, Time), av(temp_categorize(Day,Time),frozen), av(hotcold(X), hot)]),
	rhs(av(like_recipe(X), true), 0.45)
).

rule(
	'WEATHERR14b',
	lhs([av(which_day,Day), av(mealTime, Time), av(temp_categorize(Day,Time),frozen), av(protein(X), high)]),
	rhs(av(like_recipe(X), true), 0.45)
).
rule(
	'WEATHERR14c',
	lhs([av(which_day, Day), av(mealTime, Time), av(temp_categorize(Day, Time), frozen), av(fat(X), high)]),
	rhs(av(like_recipe(X), true), 0.745)
).
rule(
	'WEATHERR14d',
	lhs([av(which_day,Day), av(mealTime, Time), av(temp_categorize(Day,Time), frozen), av(glucose(X), high)]),
	rhs(av(like_recipe(X), true), 0.45)
).
rule(
	'WEATHERR14e',
	lhs([av(which_day, Day), av(mealTime, Time), av(temp_categorize(Day, Time), frozen), av(calorie(X), high)]),
	rhs(av(like_recipe(X), true), 0.45)
).